/**
 * 神州信息(2012)
 */
package net.abbp.report.model.info;

import org.dom4j.Element;

import net.abbp.core.util.StringUtils;
import net.abbp.report.model.io.IValueIO;

/**
 * 模型附加信息写入写出器
 * 
 * @version 1.0
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ABBP 1.0
 * 
 *        <pre>
 * 历史：
 *      建立: Aug 2, 2012 lexloo
 * </pre>
 */
public class FormInfoIO implements IValueIO {

    @Override
    public Object read(Element value) {
        FormInfo info = new FormInfo();

        String metaModel = value.elementTextTrim("MetaModel");
        info.setMetaModel(metaModel);

        return info;
    }

    @Override
    public void write(Element element, Object value) {
        FormInfo info = (FormInfo) value;

        // 写入元数据模型信息
        element.addElement("MetaModel").addText(StringUtils.convertToString(info.getMetaModel(), ""));
    }
}
